-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add new migration guide to v12 documentation that describes how… #41828
Conversation
You can preview c59b3f1 at https://pr41828-c59b3f1.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together, @aikidave
|
||
`npx localize-migrate --files=*.xlf --mapFile=messages.json` | ||
|
||
You now have a list of legacy localization IDs and new IDs, which you can use to update your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should actually be part of the previous step. I.e. after you have run localize-extract
you now have a list of legacy IDs (the mapfile) that can be used to update the IDs in your translation files.
After running localize-migrate
your translation files should now have been updated to use the new IDs. There should be nothing more to do on the application side.
|
||
Angular version 12 introduces tooling to help you migrate any existing localization ids to ids that use the latest algorithms. | ||
|
||
You have two options for migrating legacy IDs. The first method locates existing IDs, creates new IDs, and replaces the old IDs. The second method is for cases custom localization processes, such as where your localization IDs are not stored in the Angular application. Use this second method if you store your IDs in a database. This method locates legacy IDs and then creates a set of new IDs that you can then use to replace the old ones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only difference (really) between the two solutions is that the first (and by far the most common) will be to use the CLI to locate existing IDs. The other solution is to use the standalone binary localize-extract
to locate the existing IDs.
Both use the same second step, which is to run localize-migrate
to update translation files.
|
||
## What this migration does | ||
|
||
Angular version 12 introduces tooling to help you migrate any existing localization ids to ids that use the latest algorithms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since v11, all new projects use the modern IDs by default.
Also any use of $localize
in application code also uses the moden ID format.
Further, some projects use custom IDs (the set the ID for each translation manually themselves). That being said any legacy ICU messages will not have custom IDs and will need to be migrated.
So, strictly, this migration might not be necessary. Or at least when describing it we should be clear that we only need to migrate "legacy" IDs rather than all existing ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this clarification, @petebacondarwin !
c59b3f1
to
dbb83c9
Compare
You can preview dbb83c9 at https://pr41828-dbb83c9.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. A few more fixups needed.
|
||
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust the previous, legacy format. However, applications created before version 11 still used the legacy format for these IDs. | ||
|
||
With the release of Angular version 12, you now how tools available to help you migrate any existing localization ids to ids that use the latest algorithms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the release of Angular version 12, you now how tools available to help you migrate any existing localization ids to ids that use the latest algorithms. | |
With the release of Angular version 12, you now have tools available to help you migrate any existing localization IDs to IDs that use the latest algorithms. |
|
||
`ng extract-i18n --format=legacy-migrate` | ||
|
||
After running this command, you have a list of legacy localization IDs and new IDs, which you can use to update your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running this command, you have a list of legacy localization IDs and new IDs, which you can use to update your application. | |
After running this command, you have a migration file (`messages.json`) containing a mapping between legacy localization IDs and new IDs, which you can use to update your application. |
|
||
## Migrate legacy IDs using `localize-extract` | ||
|
||
To migrate legacy localization IDs using `localize-extract`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
To migrate legacy localization IDs using `localize-extract`: | |
If you are not using the Angular CLI, then you can migrate legacy localization IDs using `localize-extract`: |
|
||
`npx localize-extract --format=legacy-migrate --source=./path/to/bundles --outputPath=./` | ||
|
||
In this command, `./path/to/bundles/` represents the path to your localization files. You can set the `outputPath` parameter to any directory in your system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this command, `./path/to/bundles/` represents the path to your localization files. You can set the `outputPath` parameter to any directory in your system. | |
In this command, `./path/to/bundles/` represents the path to your distributable files. You can set the `outputPath` parameter to any directory in your system. |
The bundles will be the generated JavaScript from whatever build tooling they are using.
|
||
In this command, `./path/to/bundles/` represents the path to your localization files. You can set the `outputPath` parameter to any directory in your system. | ||
|
||
After running this command, you have a list of legacy localization IDs and new IDs, which you can use to update your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running this command, you have a list of legacy localization IDs and new IDs, which you can use to update your application. | |
After running this command, you have a migration file (`messages.json`) containing a mapping between legacy localization IDs and new IDs, which you can use to update your application. |
|
||
1. Run the `npx localize-extract` command. | ||
|
||
`npx localize-extract --format=legacy-migrate --source=./path/to/bundles --outputPath=./` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The outputPath
has to actually be a path to the file, not the directory. So
`npx localize-extract --format=legacy-migrate --source=./path/to/bundles --outputPath=./` | |
`npx localize-extract --format=legacy-migrate --source=./path/to/bundles --outputPath=./messages.json` |
|
||
## What this migration does | ||
|
||
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust the previous, legacy format. However, applications created before version 11 still used the legacy format for these IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust the previous, legacy format. However, applications created before version 11 still used the legacy format for these IDs. | |
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust than the previous, legacy format. However, applications created before version 11 still used the legacy format for these IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @ahasall !
|
||
## Why is this migration necessary | ||
|
||
The Angular translation system works by matching a message ID to a translated message in a different language. One option for creating these IDs is to have the translation system generate them for you. Previous algorithms that created these IDs have, over time, become fragile to formatting changes. The new algorithms are much more robust. This migration system helps you improve application stability by creating new legacy IDs that you can add to your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the last sentence, I'm not sure that "application stability" is the correct term. Migrating to the new system makes it more future-proof, because they won't have to migrate later when we remove the new format. It also means that the IDs will change less frequently.
aio/content/navigation.json
Outdated
{ | ||
"url": "guide/migration-legacy-message-id", | ||
"title": "Migration: Legacy Localization IDs", | ||
"tooltip": "Learn how to migrate older IDs for localization to new, more stable ones." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
older -> old. I don't think that we have any older ID algorithms than the ones we're migrating away from.
|
||
With the release of Angular version 12, you now how tools available to help you migrate any existing localization ids to ids that use the latest algorithms. | ||
|
||
You have two options for migrating legacy IDs. The first method uses the Angular CLI to locate legacy IDs in your application. The second method uses a standalone application, `localize-extract` to locate the legacy IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have two options for migrating legacy IDs. The first method uses the Angular CLI to locate legacy IDs in your application. The second method uses a standalone application, `localize-extract` to locate the legacy IDs. | |
You have two options for migrating legacy IDs. The first method uses the Angular CLI to locate legacy IDs in your application. The second method uses a standalone application, `localize-extract`, to locate the legacy IDs. |
|
||
## What this migration does | ||
|
||
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust the previous, legacy format. However, applications created before version 11 still used the legacy format for these IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust the previous, legacy format. However, applications created before version 11 still used the legacy format for these IDs. | |
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust the previous legacy format. However, applications created before version 11 still used the legacy format for these IDs. |
You can also specify other formats in the `files` parameter, such as `*.xmb`. | ||
</div> | ||
|
||
## Why is this migration necessary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Why is this migration necessary | |
## Why this migration is necessary |
Moved word for better flow
Editing review completed; a few minor suggestions.
…On Tue, Apr 27, 2021 at 11:00 AM Pete Bacon Darwin ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In aio/content/guide/migration-legacy-message-id.md
<#41828 (comment)>:
> +
+You have two options for migrating legacy IDs. The first method uses the Angular CLI to locate legacy IDs in your application. The second method uses a standalone application, `localize-extract` to locate the legacy IDs.
+
+## Migrating legacy IDs using the CLI
+
+To migrate legacy localization IDs using the CLI:
+
+1. Run the `ng extract-i18n` command.
+
+ `ng extract-i18n --format=legacy-migrate`
+
+ After running this command, you have a list of legacy localization IDs and new IDs, which you can use to update your application.
+
+1. Update the IDs in your application using the `npx localize-migrate` command.
+
+ `npx localize-migrate --files=*.xlf --mapFile=messages.json`
In that case, you can ignore my comments about npx and move on.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#41828 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AR4DPGRJY54O62MJ5ISU633TK33TBANCNFSM43UISTFQ>
.
--
*--Teri Glover--*
*Technical Editor*
|
|
||
## Why is this migration necessary | ||
|
||
The Angular translation system works by matching a message ID to a translated message in a different language. One option for creating these IDs is to have the translation system generate them for you. Previous algorithms that created these IDs have, over time, become fragile to formatting changes. The new algorithms are much more robust. This migration system helps you improve application stability by creating new legacy IDs that you can add to your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like it would be useful to move the content from "why is this migration necessary" higher up so that people more quickly know why they should care about this migration in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following the pattern of previous migration guides, but I agree. I'll put this section ahead of "What this migration does"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback!
|
||
## What this migration does | ||
|
||
Angular version 11 introduced a new format for localization IDs. These new IDs are more robust the previous, legacy format. However, applications created before version 11 still used the legacy format for these IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @ahasall !
|
||
## Why is this migration necessary | ||
|
||
The Angular translation system works by matching a message ID to a translated message in a different language. One option for creating these IDs is to have the translation system generate them for you. Previous algorithms that created these IDs have, over time, become fragile to formatting changes. The new algorithms are much more robust. This migration system helps you improve application stability by creating new legacy IDs that you can add to your application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following the pattern of previous migration guides, but I agree. I'll put this section ahead of "What this migration does"
dbb83c9
to
2c95e78
Compare
You can preview 2c95e78 at https://pr41828-2c95e78.ngbuilds.io/. |
|
||
1. Commit the updated files to your source control system. | ||
|
||
After you complete the migration, set the Angular Compiler option, `enableI18nLegacyMessageIdFormat`, to `false`. For more information about this option, see [Angular Compiler Options](/guide/angular-compiler-options#enablei18nlegacymessageidformat). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this paragraph is both here and at the bottom of the guide. Should one of them be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because these are two different sections. Folks who are reading one may not read the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm aside from other outstanding comments
2c95e78
to
97d4465
Compare
You can preview 97d4465 at https://pr41828-97d4465.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One overlooked item in editing pass.
|
||
</div> | ||
|
||
With the release of Angular version 12, you now have how tools available to help you migrate any existing localization IDs to IDs that use the latest algorithms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the release of Angular version 12, you now have how tools available to help you migrate any existing localization IDs to IDs that use the latest algorithms. | |
With the release of Angular version 12, you now have tools available to help you migrate any existing localization IDs to IDs that use the latest algorithms. |
Deleted unnecessary word.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great @aikidave - thanks for your patience with my confusion over the utility of npx
.
Oh two more things...
E.g.
|
97d4465
to
ed46fe6
Compare
You can preview ed46fe6 at https://pr41828-ed46fe6.ngbuilds.io/. |
… to migrate older localization ids to new ones
ed46fe6
to
d9cde61
Compare
You can preview d9cde61 at https://pr41828-d9cde61.ngbuilds.io/. |
Thank you, it was really usefull. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
… to migrate older localization ids to new ones
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
n/a
Issue Number: N/A
What is the new behavior?
New content that describes how to migrate legacy localization ids to new ones.
Does this PR introduce a breaking change?
Other information